1. Field of the Invention
This invention relates to an apparatus for comparing two numbers and more particularly to a high speed binary parallel digital comparator for determining one of five relationships between two binary numbers.
2. Description of the Prior Art
In data processing systems, it is frequently necessary to ascertain the relationship between two numbers in order for a given sequence of operations to occur. Thus, in most digital or data processing systems, a given data word A of n number of bits is required to be compared with another data word B of m number of bits. On the basis of their relative magnitudes, i.e. A is greater than B, A is greater than or equal to B, A equals B, A is less than or equal B, A is less than B, the operating sequence may stop, continue, or branch to another sequence. Thus, for example, in data processing systems securing data, it is usual to compare the ring number (security code number) of the presently operating job with the ring number identifying the importance of data to be utilized. If the ring number of the job is greater than the ring number of the data, the job will be halted such that the data being addressed is not allowed to be utilized. Conversely, however, if the ring number of a job is less than or equal to the ring number of the data, the operations of a job may be performed.
In the past, the methods, for comparing two binary digital numbers in parallel have been slow and inefficient. Moreover, the common methods used for implementing comparators were not modular and generally introduced longer propogation delays, higher costs, and increased complexity (more logic gate connections).
Most often, the comparison has been done by subtracting one binary number from another number digit by digit with the results being observed and an indication given as to the determination of the results. This method employs complicated and extensive circuitry requiring excessive components. The number of "AND" or "OR" gates required becomes prohibitively large for larger numbers having numerous digits therein. Additionally, limitations and speed of response resulting from inherent limitations in the complicated circuitry present another serious source of difficulty in such methods. Moreover, for some instances, the subtraction method may not be fast enough to meet the desired speed necessary for performing the operations. This is because the carry/borrow signals have to go through many levels of logic (even with carry/look-ahead schemes) before the results become stable.
The apparatus of this invention provides simple and efficient means having a fast response time for comparing two binary numbers. New and novel circuitry including fewer elements than heretofore provided produces output signals indicating one of five relationships between the two binary numbers. Moreover, the design suggested herein uses a modular approach for constructing the comparator. A basic unit is a two-bit comparator which derives the relative magnitudes of the two binary numbers each consisting of two bits. The basic units can be utilized as the building blocks to implement an N-bit comparator in a tree-type structure. Since the relative magnitudes of any two-bit group can be generated simultaneously, the speed is much faster than that of a regular subtractor. Furthermore, the realization of an N-bit comparator using this kind of building block approach is very simple and flexible.